Track wayland protocol changes.
authorScott Moreau <oreaus@gmail.com>
Thu, 23 Jun 2011 05:10:24 +0000 (23:10 -0600)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 23 Jun 2011 11:06:35 +0000 (07:06 -0400)
gdk/wayland/gdkcursor-wayland.c
gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/gdkdisplay-wayland.h
gdk/wayland/gdkscreen-wayland.c
gdk/wayland/gdkwindow-wayland.c

index e93abc8bb4cbd3b8ff50bca14dec97cbbce46a40..21b3bf5efd80fde39b5600918a1575aa5ead4f9b 100644 (file)
@@ -224,7 +224,7 @@ create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
   else
     memset (cursor->map, 0, 4);
 
-  visual = wl_display_get_premultiplied_argb_visual(display->wl_display);
+  visual = display->premultiplied_argb_visual;
   cursor->buffer = wl_shm_create_buffer(display->shm,
                                        fd,
                                        cursor->width,
index 5cd7be2bb73c338639baa52bad5ea01f1cc55856..8481e8b598cda109f7e14e51f93f41e537277ecf 100644 (file)
@@ -124,17 +124,53 @@ static const struct wl_shell_listener shell_listener = {
 
 static void
 output_handle_geometry(void *data,
-                      struct wl_output *output,
-                      int32_t x, int32_t y, int32_t width, int32_t height)
+                      struct wl_output *wl_output,
+                      int x, int y, int physical_width, int physical_height,
+                      int subpixel, const char *make, const char *model)
 {
   /*
     g_signal_emit_by_name (screen, "monitors-changed");
     g_signal_emit_by_name (screen, "size-changed");
   */
 }
+static void
+display_handle_mode(void *data,
+                   struct wl_output *wl_output,
+                   uint32_t flags,
+                   int width,
+                   int height,
+                   int refresh)
+{
+}
+
+static void
+compositor_handle_visual(void *data,
+                        struct wl_compositor *compositor,
+                        uint32_t id, uint32_t token)
+{
+       GdkDisplayWayland *d = data;
+
+       switch (token) {
+       case WL_COMPOSITOR_VISUAL_ARGB32:
+               d->argb_visual = wl_visual_create(d->wl_display, id, 1);
+               break;
+       case WL_COMPOSITOR_VISUAL_PREMULTIPLIED_ARGB32:
+               d->premultiplied_argb_visual =
+                       wl_visual_create(d->wl_display, id, 1);
+               break;
+       case WL_COMPOSITOR_VISUAL_XRGB32:
+               d->rgb_visual = wl_visual_create(d->wl_display, id, 1);
+               break;
+       }
+}
+
+static const struct wl_compositor_listener compositor_listener = {
+       compositor_handle_visual,
+};
 
 static const struct wl_output_listener output_listener = {
        output_handle_geometry,
+       display_handle_mode
 };
 
 static void
@@ -147,6 +183,8 @@ gdk_display_handle_global(struct wl_display *display, uint32_t id,
 
   if (strcmp(interface, "wl_compositor") == 0) {
     display_wayland->compositor = wl_compositor_create(display, id, 1);
+    wl_compositor_add_listener(display_wayland->compositor,
+                                          &compositor_listener, display_wayland);
   } else if (strcmp(interface, "wl_shm") == 0) {
     display_wayland->shm = wl_shm_create(display, id, 1);
   } else if (strcmp(interface, "wl_shell") == 0) {
index 88756afbb2f20727a02266f485b2ff201499aed0..787de8c28a2343c783efe2c3aaa7e73e29d37cc5 100644 (file)
@@ -71,6 +71,7 @@ struct _GdkDisplayWayland
 
   /* Wayland fields below */
   struct wl_display *wl_display;
+  struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual;
   struct wl_compositor *compositor;
   struct wl_shm *shm;
   struct wl_shell *shell;
index b1cb479179e3b0d61519f6ad850a810597b086e4..26f426de7a869add462f0ba973644c327c6f5d83 100644 (file)
@@ -482,15 +482,14 @@ _gdk_wayland_screen_new (GdkDisplay *display)
   screen_wayland->width = 8192;
   screen_wayland->height = 8192;
 
-  visual = wl_display_get_argb_visual(display_wayland->wl_display);
+  visual = display_wayland->argb_visual;
   screen_wayland->argb_visual = gdk_wayland_visual_new (screen, visual);
 
-  visual =
-    wl_display_get_premultiplied_argb_visual(display_wayland->wl_display);
+  visual = display_wayland->premultiplied_argb_visual;
   screen_wayland->premultiplied_argb_visual =
     gdk_wayland_visual_new (screen, visual);
 
-  visual = wl_display_get_rgb_visual(display_wayland->wl_display);
+  visual = display_wayland->rgb_visual;
   screen_wayland->rgb_visual = gdk_wayland_visual_new (screen, visual);
 
   screen_wayland->root_window =
index c19b3c55567383a342c4a619d874b571520356e3..194d7633e51cf46db90df79de197e6e5daa31447 100644 (file)
@@ -392,7 +392,7 @@ gdk_wayland_create_cairo_surface (GdkDisplayWayland *display,
   data = g_new (GdkWaylandCairoSurfaceData, 1);
   data->display = display;
   data->buffer = NULL;
-  visual = wl_display_get_premultiplied_argb_visual(display->wl_display);
+  visual = display->premultiplied_argb_visual;
   data->width = width;
   data->height = height;
   data->pixmap = wl_egl_pixmap_create(width, height, visual, 0);
@@ -450,6 +450,8 @@ gdk_wayland_window_map (GdkWindow *window)
 {
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
   GdkWindowImplWayland *parent;
+  GdkDisplayWayland *display_wayland =
+               GDK_DISPLAY_WAYLAND (gdk_window_get_display (impl->wrapper));
 
   if (!impl->mapped)
     {
@@ -462,11 +464,11 @@ gdk_wayland_window_map (GdkWindow *window)
                  window->y);
 
          parent = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl);
-         wl_surface_map_transient (impl->surface, parent->surface,
+         wl_shell_set_transient (display_wayland->shell, impl->surface, parent->surface,
                                    window->x, window->y, 0);
        }
       else
-       wl_surface_map_toplevel (impl->surface);
+      wl_shell_set_toplevel (display_wayland->shell, impl->surface);
       impl->mapped = TRUE;
     }
 }